#include <iostream>
using namespace std;

int ilcf(int, int);
int rlcf(int, int);

int main()
{
	cout << "ilcf(100, 70) = " << ilcf(100, 70) << endl;
	cout << "rlcf(48, 18) = " << rlcf(48, 18) << endl;
	system("pause");
	return 0;
}

int ilcf(int n, int m)
{
	if (n < m)
	{
		int temp = n;
		n = m;
		m = temp;
	}
	
	do
	{
		int temp = m;
		m = n % m;
		n = temp;
	} while (m != 0);
	
	return n;
}

int rlcf(int n, int m)
{
	if (n % m != 0)
	{
		return rlcf(m, n%m);
	}
	else
	{
		return m;
	}
}